package com.sk.weichat.adapter;

import android.graphics.PointF;
import android.graphics.drawable.AnimationDrawable;
import android.os.Handler;
import android.support.v4.content.ContextCompat;
import android.text.SpannableString;
import android.text.Spanned;
import android.text.TextUtils;
import android.text.style.ImageSpan;
import android.util.Log;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import com.chad.library.adapter.base.BaseMultiItemQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.facebook.drawee.view.SimpleDraweeView;
import com.sk.weichat.R;
import com.sk.weichat.bean.Friend;
import com.sk.weichat.bean.RoomMember;
import com.sk.weichat.bean.message.ChatMessage;
import com.sk.weichat.bean.message.MucRoom;
import com.sk.weichat.bean.message.XmppMessage;
import com.sk.weichat.bean.redpacket.RedPacketNoticeBean;
import com.sk.weichat.broadcast.MsgBroadcast;
import com.sk.weichat.db.InternationalizationHelper;
import com.sk.weichat.db.dao.ChatMessageDao;
import com.sk.weichat.db.dao.FriendDao;
import com.sk.weichat.db.dao.GroupMessageDao;
import com.sk.weichat.db.dao.RedPacketNoticeDao;
import com.sk.weichat.db.dao.RoomMemberDao;
import com.sk.weichat.helper.AvatarHelper;
import com.sk.weichat.ui.base.CoreManager;
import com.sk.weichat.util.FrescoUtils;
import com.sk.weichat.util.HtmlUtils;
import com.sk.weichat.util.StringUtils;
import com.sk.weichat.util.TimeUtils;
import com.sk.weichat.util.UiUtils;
import com.sk.weichat.view.DragBubbleView.DragBubbleView;
import com.sk.weichat.view.DragBubbleView.DragBubbleViewAdapter;
import com.sk.weichat.view.DragBubbleView.DragBubbleViewListener;
import com.sk.weichat.view.HeadView;
import com.sk.weichat.view.MyImageSpan;
import com.sk.weichat.xmpp.listener.ChatMessageListener;
import com.swipemenulib.SwipeMenuLayout;

import java.util.ArrayList;
import java.util.List;

public class MultipleItemAdapter extends BaseMultiItemQuickAdapter<MyMultipleItem, BaseViewHolder> {

    private final ArrayList<Friend> mUnReplyList;
    private final List<Friend> mNewFriendList;
    private String mLoginUserId;

    public MultipleItemAdapter(String mLoginUserId, List data, ArrayList<Friend> unReplyList, List<Friend> newFriendMessageList) {
        super(data);
        this.mLoginUserId = mLoginUserId;
        this.mUnReplyList = unReplyList;
        this.mNewFriendList = newFriendMessageList;
        //必须绑定type和layout的关系
        addItemType(MyMultipleItem.CALL_TYPE, R.layout.item_message_call);
        addItemType(MyMultipleItem.RELATION_TYPE, R.layout.item_message_relation);
        addItemType(MyMultipleItem.NORMAL_TYPE, R.layout.item_message_slide2);
        addItemType(MyMultipleItem.GROUP_TYPE, R.layout.item_message_group);
        addItemType(MyMultipleItem.WALLET_TYPE, R.layout.item_message_wallet);
    }

    @Override
    protected void convert(BaseViewHolder holder, MyMultipleItem item) {
        switch (holder.getItemViewType()) {
            case MyMultipleItem.CALL_TYPE://打招呼消息item
                convertCallItem(holder);
                break;

            case MyMultipleItem.RELATION_TYPE://关系消息item
                convertRelationItem(holder);
                break;

            case MyMultipleItem.GROUP_TYPE://群通知
                convertGroupItem(holder, item);
                break;

            case MyMultipleItem.NORMAL_TYPE:
                convertNormalItem(holder, item);
                break;

            case MyMultipleItem.WALLET_TYPE:
                covertWalletItem(holder, item);
                break;
        }
    }

    private void covertWalletItem(BaseViewHolder holder, MyMultipleItem item) {
        holder.addOnClickListener(R.id.root_view);
        holder.setText(R.id.tv_msg_title, "钱包通知");
        holder.setText(R.id.tv_msg_content, item.getMsg_content());
        holder.setText(R.id.tv_time, TimeUtils.getFriendlyTimeDesc(holder.itemView.getContext(), item.getTime()));
        DragBubbleView tvUnReadCount = holder.getView(R.id.view_count);
        tvUnReadCount.setBackgroundDrawable(holder.itemView.getResources().getDrawable(R.drawable.red_bg));
        UiUtils.updateNum(tvUnReadCount, item.getCount());
        tvUnReadCount.setOnDragListener(new DragBubbleViewListener() {

            @Override
            public void onBubbleViewDismiss() {
                //全部设置为已读
                List<RedPacketNoticeBean> list = RedPacketNoticeDao.getInstance().queryUnRead();
                for (int i = 0; i < list.size(); i++) {
                    list.get(i).setIsRead(1);
                    RedPacketNoticeDao.getInstance().update(list.get(i));
                }
            }

            @Override
            public void onBubbleViewDragging(PointF dragPoint) {

            }

            @Override
            public void onBubbleViewReset() {

            }
        });
    }


    private void convertGroupItem(BaseViewHolder holder, MyMultipleItem item) {
        holder.addOnClickListener(R.id.layout_group_item);
        TextView nick_name_tv = holder.getView(R.id.nick_name_tv);
        TextView content_tv = holder.getView(R.id.content_tv);
        DragBubbleView num_tv = holder.getView(R.id.num_tv);
        TextView time_tv = holder.getView(R.id.time_tv);

        nick_name_tv.setText("群通知");
        if (TextUtils.isEmpty(item.getData().getContent())) {
            content_tv.setText("暂无群通知");
            time_tv.setVisibility(View.GONE);
        } else {
            content_tv.setText(item.getData().getContent());
            time_tv.setVisibility(View.VISIBLE);
            time_tv.setText(TimeUtils.getFriendlyTimeDesc(holder.itemView.getContext(), item.getData().getTimeSend()));
        }

        if (item.getData().getUnReadNum() == 0) {
            if (!TextUtils.isEmpty(num_tv.getText().toString())) {
                // 主要作用 清除全部未读消息的时候 红点实现爆炸效果
                num_tv.setBackground(holder.itemView.getResources().getDrawable(R.drawable.anim_list));
                AnimationDrawable animationDrawable = (AnimationDrawable) num_tv.getBackground();
                animationDrawable.start();
                new Handler().postDelayed(new Runnable() {
                    @Override
                    public void run() {
                        animationDrawable.stop();
                        num_tv.setText("");
                        num_tv.setVisibility(View.INVISIBLE);
                    }
                }, 400);
            }
        } else {
            num_tv.setBackgroundDrawable(holder.itemView.getResources().getDrawable(R.drawable.red_bg));
            UiUtils.updateNum(num_tv, item.getData().getUnReadNum());
        }

        num_tv.setOnDragListenerAdapter(new DragBubbleViewAdapter() {
            @Override
            public void onBubbleViewDismiss() {
                super.onBubbleViewDismiss();
                //清除群通知
                GroupMessageDao.getInstance().markUserMessageRead(mLoginUserId);
                MsgBroadcast.broadcastMsgUiUpdate(mContext);
            }
        });

    }

    private void convertRelationItem(BaseViewHolder holder) {
        holder.addOnClickListener(R.id.layout_relation_item);
        TextView nick_name_tv = holder.getView(R.id.nick_name_tv);
        TextView content_tv = holder.getView(R.id.content_tv);
        DragBubbleView num_tv = holder.getView(R.id.num_tv);
        TextView time_tv = holder.getView(R.id.time_tv);

        nick_name_tv.setText("关系通知");

        if (mNewFriendList.size() == 0) {
            content_tv.setText("暂无关系通知");
            time_tv.setVisibility(View.GONE);
            num_tv.setVisibility(View.INVISIBLE);
        } else {
            fillFriendState(mNewFriendList.get(0), content_tv);
            time_tv.setVisibility(View.VISIBLE);
            time_tv.setText(TimeUtils.getFriendlyTimeDesc(holder.itemView.getContext(), mNewFriendList.get(0).getTimeSend()));

        }

        if (mNewFriendList.size() > 0) {
            if (mNewFriendList.get(0).getUnReadNum() == 0) {
                if (!TextUtils.isEmpty(num_tv.getText().toString())) {
                    // 主要作用 清除全部未读消息的时候 红点实现爆炸效果
                    num_tv.setBackground(holder.itemView.getResources().getDrawable(R.drawable.anim_list));
                    AnimationDrawable animationDrawable = (AnimationDrawable) num_tv.getBackground();
                    animationDrawable.start();
                    new Handler().postDelayed(new Runnable() {
                        @Override
                        public void run() {
                            animationDrawable.stop();
                            num_tv.setText("");
                            num_tv.setVisibility(View.INVISIBLE);
                        }
                    }, 400);
                }
            } else {
                num_tv.setBackgroundDrawable(holder.itemView.getResources().getDrawable(R.drawable.red_bg));
                UiUtils.updateNum(num_tv, mNewFriendList.get(0).getUnReadNum());
            }
        }

        num_tv.setOnDragListenerAdapter(new DragBubbleViewAdapter() {
            @Override
            public void onBubbleViewDismiss() {
                super.onBubbleViewDismiss();
                //清除关系通知
                FriendDao.getInstance().markUserMessageRead(mLoginUserId, Friend.ID_NEW_FRIEND_MESSAGE);
                MsgBroadcast.broadcastMsgUiUpdate(mContext);
            }
        });
    }

    private void convertCallItem(BaseViewHolder holder) {
        holder.addOnClickListener(R.id.layout_call_item);
        TextView nick_name_tv = holder.getView(R.id.nick_name_tv);
        TextView content_tv = holder.getView(R.id.content_tv);
        DragBubbleView num_tv = holder.getView(R.id.num_tv);
        TextView time_tv = holder.getView(R.id.time_tv);

        if (mUnReplyList.size() > 0) {
            nick_name_tv.setText("有" + mUnReplyList.size() + "个人给您发来招呼消息");
        }
        int UnReadNumCount = 0;
        for (Friend friend : mUnReplyList) {
            UnReadNumCount += friend.getUnReadNum();
        }
        // 主要作用 清除全部未读消息的时候 红点实现爆炸效果
        if (UnReadNumCount == 0) {
            if (!TextUtils.isEmpty(num_tv.getText().toString())) {
                // 主要作用 清除全部未读消息的时候 红点实现爆炸效果
                num_tv.setBackground(holder.itemView.getResources().getDrawable(R.drawable.anim_list));
                AnimationDrawable animationDrawable = (AnimationDrawable) num_tv.getBackground();
                animationDrawable.start();
                new Handler().postDelayed(new Runnable() {
                    @Override
                    public void run() {
                        animationDrawable.stop();
                        num_tv.setText("");
                        num_tv.setVisibility(View.INVISIBLE);
                    }
                }, 400);
            }
        } else {
            num_tv.setBackgroundDrawable(holder.itemView.getResources().getDrawable(R.drawable.red_bg));
            UiUtils.updateNum(num_tv, UnReadNumCount);
        }
        num_tv.setOnDragListenerAdapter(new DragBubbleViewAdapter() {
            @Override
            public void onBubbleViewDismiss() {
                super.onBubbleViewDismiss();
                //清除招呼消息
                for (Friend friend : mUnReplyList) {
                    friend.setUnReadNum(0);
                    FriendDao.getInstance().markUserMessageRead(mLoginUserId, friend.getUserId());
                }
                MsgBroadcast.broadcastMsgUiUpdate(mContext);
            }
        });

        Friend friend = mUnReplyList.get(0);

        time_tv.setText(TimeUtils.getFriendlyTimeDesc(holder.itemView.getContext(), friend.getTimeSend()));
        if (friend.getType() == XmppMessage.TYPE_TEXT) {// 文本消息 表情
            String s = StringUtils.replaceSpecialChar(friend.getContent());
            CharSequence content = HtmlUtils.transform200SpanString(s.replaceAll("\n", "\r\n"), true);
            // TODO: 这样匹配的话正常消息里的&8824也会被替换掉，
            if (content.toString().contains("&8824")) {// 草稿
                content = content.toString().replaceFirst("&8824", "");
            }
            content_tv.setText(TextUtils.isEmpty(friend.getRemarkName()) ? friend.getNickName() + ":" + content : friend.getRemarkName() + ":" + content, TextView.BufferType.SPANNABLE);
        } else {
            content_tv.setText(TextUtils.isEmpty(friend.getRemarkName()) ? friend.getNickName() : friend.getRemarkName() + ":" + HtmlUtils.addSmileysToMessage(
                    ChatMessage.getSimpleContent(holder.itemView.getContext(), friend.getType(), friend.getContent()),
                    false
            ), TextView.BufferType.SPANNABLE);
        }
    }

    private void convertNormalItem(BaseViewHolder holder, MyMultipleItem item) {
        holder.addOnClickListener(R.id.item_friend_warp)
                .addOnClickListener(R.id.replay_iv)
                .addOnClickListener(R.id.num_tv)
                .addOnClickListener(R.id.top_tv)
                .addOnClickListener(R.id.read_unread_tv)
                .addOnClickListener(R.id.delete_tv);

        SwipeMenuLayout swipe_menu_layout = holder.getView(R.id.swipe_menu_layout);
        ImageView imgTop = holder.getView(R.id.img_msg_top);
        HeadView avatar = holder.getView(R.id.avatar_imgS);
        TextView nick_name_tv = holder.getView(R.id.nick_name_tv);
        TextView tip_tv = holder.getView(R.id.item_message_tip);
        TextView content_tv = holder.getView(R.id.content_tv);
        DragBubbleView num_tv = holder.getView(R.id.num_tv);
        TextView time_tv = holder.getView(R.id.time_tv);
        ImageView replay_iv = holder.getView(R.id.replay_iv);
//        ImageView not_push_ll = holder.getView(R.id.not_push_iv);
        TextView top_tv = holder.getView(R.id.top_tv);
        TextView mark_read_tv = holder.getView(R.id.read_unread_tv);
        top_tv.setVisibility(View.VISIBLE);
        mark_read_tv.setVisibility(View.VISIBLE);
        TextView delete_tv = holder.getView(R.id.delete_tv);
        //ImageView imgSystemFlag = holder.getView(R.id.img_system_flag);

        Friend friend = item.getData();
        AvatarHelper.getInstance().displayAvatar(mLoginUserId, friend, avatar);

        nick_name_tv.setText(!TextUtils.isEmpty(friend.getRemarkName()) ? friend.getRemarkName() : friend.getNickName());
        tip_tv.setVisibility(View.GONE);

        if (friend.getUserId().equals(Friend.ID_SYSTEM_MESSAGE)) {//客服
            delete_tv.setVisibility(View.GONE);
            //imgSystemFlag.setVisibility(View.VISIBLE);
            String name = nick_name_tv.getText().toString();
            SpannableString spannableString = new SpannableString(name + "   ");
            MyImageSpan imageSpan = new MyImageSpan(mContext, R.mipmap.icon_kefu, ImageSpan.ALIGN_BOTTOM);
            spannableString.setSpan(imageSpan, name.length() + 1, name.length() + 3, Spanned.SPAN_INCLUSIVE_EXCLUSIVE);
            nick_name_tv.setText(spannableString);

        } else {
            delete_tv.setVisibility(View.VISIBLE);
            //imgSystemFlag.setVisibility(View.GONE);
        }
        ChatMessage lastMessage = ChatMessageDao.getInstance().getLastChatMessage(mLoginUserId, friend.getUserId());
        if (friend.getRoomFlag() == 0) {
            if (lastMessage != null && lastMessage.isMySend() && ChatMessageListener.MESSAGE_SEND_SUCCESS == lastMessage.getMessageState() && friend.getType() != XmppMessage.TYPE_RED) {
                if (lastMessage.isSendRead()) {
                    tip_tv.setText("[已读]");
                    tip_tv.setTextColor(ContextCompat.getColor(mContext, R.color.text_color_content));
                    tip_tv.setVisibility(View.VISIBLE);
                } else {
                    tip_tv.setText("[送达]");
                    tip_tv.setTextColor(ContextCompat.getColor(mContext, R.color.color_27A2FF));
                    tip_tv.setVisibility(View.VISIBLE);
                }
            } else {
                if (friend.getType() == XmppMessage.TYPE_RED) {
                    tip_tv.setText(R.string.mesg_redpacket);
                    tip_tv.setTextColor(ContextCompat.getColor(mContext, R.color.color_ff2626));
                    tip_tv.setVisibility(View.VISIBLE);
                }
            }
        }

        if (friend.getRoomFlag() != 0) {// 群组 @
            if (friend.getIsAtMe() == 1) {
                tip_tv.setText("[有人@我]");
                tip_tv.setTextColor(ContextCompat.getColor(mContext, R.color.color_red));
                tip_tv.setVisibility(View.VISIBLE);
            } else if (friend.getIsAtMe() == 2) {
                tip_tv.setText("[@全体成员]");
                tip_tv.setTextColor(ContextCompat.getColor(mContext, R.color.color_red));
                tip_tv.setVisibility(View.VISIBLE);
            }
            if (friend.getType() == XmppMessage.TYPE_RED) {
                tip_tv.setText(R.string.mesg_redpacket);
                tip_tv.setTextColor(ContextCompat.getColor(mContext, R.color.color_ff2626));
                tip_tv.setVisibility(View.VISIBLE);
            }
        }
        if (friend.getType() == XmppMessage.TYPE_TEXT) {// 文本消息 表情
            String s = StringUtils.replaceSpecialChar(friend.getContent());
            CharSequence content = HtmlUtils.transform200SpanString(s.replaceAll("\n", "\r\n"), true);
            // TODO: 这样匹配的话正常消息里的&8824也会被替换掉，
            if (content.toString().contains("&8824")) {// 草稿
                content = content.toString().replaceFirst("&8824", "");

                tip_tv.setText(InternationalizationHelper.getString("JX_Draft"));
                tip_tv.setTextColor(ContextCompat.getColor(mContext, R.color.color_red));
                tip_tv.setVisibility(View.VISIBLE);
            }
            content_tv.setText(content, TextView.BufferType.SPANNABLE);
        } else if (friend.getType() == XmppMessage.TYPE_RED) {
            if (friend.getRoomFlag() != 0) {
                //群聊
                content_tv.setText(HtmlUtils.addSmileysToMessage(friend.getContent(),
                        false
                ), TextView.BufferType.SPANNABLE);
            } else if (lastMessage != null) {
                content_tv.setText(HtmlUtils.addSmileysToMessage(
                        lastMessage.getContent(),
                        false
                ), TextView.BufferType.SPANNABLE);
            }
        } else {
            content_tv.setText(HtmlUtils.addSmileysToMessage(
                    ChatMessage.getSimpleContent(holder.itemView.getContext(), friend.getType(), friend.getContent()),
                    false
            ), TextView.BufferType.SPANNABLE);
        }
        if (friend.getOfflineNoPushMsg() == 1) {
            num_tv.setBackgroundColor(holder.itemView.getResources().getColor(R.color.color_BDC2C8));
            num_tv.setBackgroundDrawable(holder.itemView.getResources().getDrawable(R.drawable.gray_bg));
            mark_read_tv.setVisibility(View.GONE);
        } else {
            num_tv.setBackgroundColor(holder.itemView.getResources().getColor(R.color.color_F74C31));
            num_tv.setBackgroundDrawable(holder.itemView.getResources().getDrawable(R.drawable.red_bg));
            mark_read_tv.setVisibility(View.VISIBLE);
        }

        if (friend.getUnReadNum() == 0) {
            if (!TextUtils.isEmpty(num_tv.getText().toString())) {
                // 主要作用 清除全部未读消息的时候 红点实现爆炸效果
                num_tv.setBackground(holder.itemView.getResources().getDrawable(R.drawable.anim_list));
                AnimationDrawable animationDrawable = (AnimationDrawable) num_tv.getBackground();
                animationDrawable.start();
                new Handler().postDelayed(new Runnable() {
                    @Override
                    public void run() {
                        animationDrawable.stop();
                        num_tv.setText("");
                        num_tv.setVisibility(View.INVISIBLE);
                        replay_iv.setVisibility(View.VISIBLE);
                    }
                }, 400);
            }

        } else {
            if (friend.getOfflineNoPushMsg() == 1) {
                num_tv.setBackgroundDrawable(holder.itemView.getResources().getDrawable(R.drawable.gray_bg));
            } else {
                num_tv.setBackgroundDrawable(holder.itemView.getResources().getDrawable(R.drawable.red_bg));
            }
            UiUtils.updateNum(num_tv, friend.getUnReadNum());
        }
        num_tv.setOnDragListener(new DragBubbleViewListener() {
            @Override
            public void onBubbleViewDismiss() {
                //拖动红点结束  打开滑动删除
                swipe_menu_layout.setSwipeEnable(true);
                FriendDao.getInstance().markUserMessageRead(mLoginUserId, friend.getUserId());
                MsgBroadcast.broadcastMsgUiUpdate(mContext);
            }

            @Override
            public void onBubbleViewDragging(PointF dragPoint) {
                if (swipe_menu_layout.isSwipeEnable()) {//消息红点拖动 屏蔽右滑删除 控件滑动
                    swipe_menu_layout.quickClose();
                    swipe_menu_layout.setSwipeEnable(false);
                }
            }

            @Override
            public void onBubbleViewReset() {
                //拖动红点结束  打开滑动删除
                swipe_menu_layout.setSwipeEnable(true);

            }
        });
        time_tv.setText(TimeUtils.getFriendlyTimeDesc(holder.itemView.getContext(), friend.getTimeSend()));
        if (num_tv.getVisibility() == View.VISIBLE) {
            replay_iv.setVisibility(View.INVISIBLE);
        } else {
            replay_iv.setVisibility(View.VISIBLE);
        }
        if (friend.getUserId().equals(Friend.ID_SK_PAY)) {
            replay_iv.setVisibility(View.INVISIBLE);
        }


        final long time = friend.getTopTime();

        //置顶
        if (time == 0) {//非置顶
            top_tv.setText(InternationalizationHelper.getString("JX_Top"));
            imgTop.setVisibility(View.GONE);
        } else {//置顶
            top_tv.setText(InternationalizationHelper.getString("JX_CancelTop"));
            imgTop.setVisibility(View.VISIBLE);
        }
        if (friend.getUnReadNum() > 0) {
            mark_read_tv.setText(R.string.mark_read);
        } else {
            mark_read_tv.setText(R.string.mark_unread);
        }

    }

    private void fillFriendState(Friend friend, TextView tvDesc) {
        switch (friend.getStatus()) {
            case Friend.STATUS_20://默认值什么都不显示
                tvDesc.setText("");
                break;
            case Friend.STATUS_10://显示  等待验证
                tvDesc.setText(InternationalizationHelper.getString("JXFriendObject_WaitPass"));
                break;
            case Friend.STATUS_11: //被关注
                // tvDesc.setText(InternationalizationHelper.getString("JXUserInfoVC_Hello"));
                tvDesc.setText(friend.getNickName() + mContext.getString(R.string.attention_me));
                break;
            case Friend.STATUS_12: //已通过验证
                tvDesc.setText(InternationalizationHelper.getString("JXFriendObject_Passed"));
                break;
            case Friend.STATUS_13: //验证被通过了
                tvDesc.setText(InternationalizationHelper.getString("JXFriendObject_PassGo"));
                break;
            case Friend.STATUS_14://别人回话
                tvDesc.setText(friend.getContent());
                break;
            case Friend.STATUS_15://回话
                tvDesc.setText(friend.getContent());
                break;
            case Friend.STATUS_16://已删除了XXX
                tvDesc.setText(InternationalizationHelper.getString("JXAlert_DeleteFirend") + friend.getNickName());
                break;
            case Friend.STATUS_17://XXX删除了我
                tvDesc.setText(friend.getContent() + mContext.getString(R.string.delete_me));
                break;
            case Friend.STATUS_18://已拉黑了XXX
                tvDesc.setText("你拉黑了" + friend.getNickName());
                break;
            case Friend.STATUS_19://XXX拉黑了你
                tvDesc.setText(friend.getNickName() + "拉黑了你");
                break;
            case Friend.STATUS_21://XXX 添加你为好友
                tvDesc.setText(friend.getNickName() + mContext.getString(R.string.add_me_as_friend));
                break;
            case Friend.STATUS_22://你添加好友 XXX
                Friend privateFriend = FriendDao.getInstance().getFriend(friend.getOwnerId(), friend.getUserId());
                if (privateFriend != null && privateFriend.getStatus() == Friend.STATUS_SYSTEM) {
                    tvDesc.setText(mContext.getString(R.string.added_notice_friend) + friend.getNickName());
                } else {
                    tvDesc.setText(mContext.getString(R.string.added_friend) + friend.getNickName());
                }
                break;
            case Friend.STATUS_24://XXX把你移出黑名单
                tvDesc.setText(friend.getNickName() + "把你移出黑名单");
                break;
            case Friend.STATUS_25://通过手机联系人添加
                tvDesc.setText("通过手机联系人加为好友");
                break;
            case Friend.STATUS_26://被后台删除的好友，仅用于新的好友页面显示，
                tvDesc.setText(friend.getContent());
                break;

            case Friend.STATUS_27://你取关了XXX，解除好友关系
                tvDesc.setText("你取关了" + friend.getNickName() + "，解除好友关系");
                break;

            case Friend.STATUS_28://XXX取关了你，解除好友关系
                tvDesc.setText(friend.getNickName() + "取关了你，解除好友关系");
                break;

            case Friend.STATUS_29://你把XXX移出黑名单
                tvDesc.setText("你把" + friend.getNickName() + "移出黑名单");
                break;
            case Friend.STATUS_30://你移粉你，解除好友关系
                tvDesc.setText(friend.getNickName() + "移粉你，解除好友关系");
                break;

            case Friend.STATUS_31://你移粉XX，解除好友关系
                tvDesc.setText("你移除" + friend.getNickName() + "粉丝，解除好友关系");
                break;
        }
    }
}
